// 引入 fs 模块
const fs = require("fs");

/* 
  fs.readFile('./resources/为学.md', (err, data1) => {
    fs.readFile('./resources/插秧诗.md', (err, data2) => {
      fs.readFile('./resources/观书有感.md', (err, data3) => {
        let result = data1 + '\r\n' + data2 + '\r\n' + data3
        console.log(result); 
      });
    });
  }); 
*/

let p = new Promise((resolve, reject) => {
  fs.readFile('./resources/为学.md', (err, data1) => {
    resolve(data1)
  })
});

p.then(value => {
  return new Promise((resolve, reject) => {
    fs.readFile('./resources/插秧诗.md', (err, data2) => {
      resolve([value, data2])
    })
  });
}).then(value => {
  return new Promise((resolve, reject) => {
    fs.readFile('./resources/观书有感.md', (err, data3) => {
      value.push(data3)
      resolve(value)
    })
  });
}).then(value => {
  console.log(value.toString())
})
